pub mod clockin;
pub mod shift;


use poem_openapi::{CombinedAPI, payload::{PlainText}, OpenApi};

pub struct Api;

#[OpenApi]
impl Api {
    #[oai(path = "/", method = "get")]
    async fn api(
        &self,
        #[oai(name = "name", in = "query")] name: Option<String>,
    ) -> PlainText<String> {
        println!("访问路径v =================  /");
        match name {
            Some(name) => {
                PlainText(format!("hello, {}!", name))
            },
            None => PlainText("hello!".to_string()),
        }
    }

}

/// ## Controllers
pub mod contro {

    use super::*;

    use crate::api::{clockin::clock_contro::ClockApi, shift::controller::ShiftApi};

    pub fn init() -> CombinedAPI<Api, CombinedAPI<ClockApi, ShiftApi>> {
        Api.combine(ClockApi.combine(ShiftApi))
    }
    
}